﻿#ifndef RECENTFILES_H
#define RECENTFILES_H

#include <QObject>
#include <QMenu>
#include <QSettings>
#include "mainwindow.h"
#include <QTimer>

class recentFiles : public QMenu
{
    Q_OBJECT
public:
    explicit recentFiles(QWidget *parent = 0);
    ~recentFiles();
private:
    QList<QAction*> actionItem;
    QSettings *setting_config;
    QAction *clearRecent;
    void initMenu();
signals:
    void openRecentFile(QString url);
public slots:
    void reloadList(QStringList list);
};

template<typename T>
T FindTopParent(QObject *obj){
    if(obj){
        if(obj->parent()){
            FindTopParent<T>(obj->parent());
        }else{
            return qobject_cast<T>(obj);//wnd;
        }
    }
}
#endif // RECENTFILES_H
